﻿package mortal.game.view.medal
{
    import Message.DB.Tables.*;
    import __AS3__.vec.*;
    import extend.language.*;
    import flash.utils.*;
    import mortal.game.cache.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.view.common.util.*;

    public class MedalUtil extends Object
    {

        public function MedalUtil()
        {
            return;
        }// end function

        public static function getMedalNameByTmedal(param1:TMedal) : String
        {
            var _loc_2:String = null;
            return "<font color=\'#E2CD9E\'>[" + Language.getString(35407) + "]</font>" + "<font color=\'#FF7902\'>" + param1.name + "</font>";
        }// end function

        public static function getMedalIconUrlByTmedal(param1:TMedal, param2:int) : String
        {
            var _loc_3:String = null;
            if (param1)
            {
                if (param2 == 0)
                {
                    _loc_3 = "medalSmall_" + param1.catagory + "_" + param1.type + ".jpg";
                }
                else
                {
                    _loc_3 = "medalBig_" + param1.catagory + "_" + param1.type + ".png";
                }
            }
            else
            {
                _loc_3 = "medalBig_0.png";
            }
            return _loc_3;
        }// end function

        public static function getMedalTotalComabtByMedals(param1:Dictionary) : int
        {
            var _loc_4:String = null;
            var _loc_2:Number = 0;
            var _loc_3:* = MountConfig.instance.attribute;
            for each (_loc_4 in _loc_3)
            {
                
                _loc_2 = _loc_2 + CombatUtil.getCombatValueByName(_loc_4, getTotalValueByName(_loc_4, param1));
            }
            return int(_loc_2);
        }// end function

        public static function getCombatByTmedal(param1:TMedal) : Number
        {
            var _loc_4:String = null;
            var _loc_2:Number = 0;
            var _loc_3:* = MountConfig.instance.attribute;
            for each (_loc_4 in _loc_3)
            {
                
                if (param1.hasOwnProperty(_loc_4))
                {
                    _loc_2 = _loc_2 + CombatUtil.getCombatValueByName(_loc_4, param1[_loc_4]);
                }
            }
            return _loc_2;
        }// end function

        public static function getTotalValueByName(param1:String, param2:Dictionary) : int
        {
            var _loc_3:int = 0;
            var _loc_4:TMedal = null;
            for each (_loc_4 in param2)
            {
                
                if (_loc_4.hasOwnProperty(param1))
                {
                    _loc_3 = _loc_3 + _loc_4[param1];
                }
            }
            return _loc_3;
        }// end function

        public static function getHeightstMedal() : TMedal
        {
            var _loc_2:int = 0;
            var _loc_3:String = null;
            var _loc_1:* = Cache.instance.medal.medalDic;
            for (_loc_3 in _loc_1)
            {
                
                if (_loc_2 == 0 || _loc_2 < int(_loc_3))
                {
                    _loc_2 = int(_loc_3);
                }
            }
            return _loc_1[_loc_2];
        }// end function

    }
}
